package com.catazy.mvvmlib.ext.download

/**
 * 作者: Tao
 * 日期: 2024/1/30
 * 时间: 11:12
 * 描述:
 */
interface DownloadProgressListener {

    /**
     * 下载进度
     * @param key 下载的key
     * @param progress 下载进度
     * @param read 已下载大小
     * @param count 总大小
     * @param done 是否下载完成
     */
    fun onUpdate(key: String, progress: Int, read: Long, count: Long, done: Boolean)
}

interface OnDownloadListener : DownloadProgressListener {

    //等待下载
    fun onDownloadPrepare(key: String)

    //下载失败
    fun onDownloadError(key: String, throwable: Throwable)

    //下载成功
    fun onDownloadSuccess(key: String, path: String, size: Long)

    //下载暂停
    fun onDownloadPause(key: String)
}